package com.hr.builder;

import org.springframework.stereotype.Component;

import com.espirit.eap.manager.ModelBuilderSupport;
import com.hr.RewardFaultItem;

@Component
public class RewardFaultItemBuilder extends ModelBuilderSupport {
	static final String EMPLOYEE = "employee";
	static final String DEPARTMENT = "department";
	static final String CREATEDON = "createdOn";
	static final String AMOUNT = "amount";
	static final String REMARK = "remark";
	
	static final String REALDATE = "realDate";
	static final String CREATED = "created";
	static final String DEPTIDS = "deptIds";
	
	static final String REWARDAMOUNT = "rewardAmount";
	static final String PUNISHAMOUNT = "punishAmount";
	
	@Override
	public boolean init() {
		return super.setClass(RewardFaultItem.class, "RewardFault Item", "奖惩清单");
	}

	@Override
	public void buildFields() {
		super.buildFields();
		addModelField(EMPLOYEE, "Employee", "职员");
		addModelField(DEPARTMENT, "Department", "部门");
		addModelField(DEPTIDS, "Department", "部门");
		addModelField(CREATEDON, "Created", "创建日期");
		addModelField(AMOUNT, "Amount", "奖惩金额");
		
		addModelField(REWARDAMOUNT, "Reward Amt", "奖励金额");
		addModelField(PUNISHAMOUNT, "Punish Amt", "惩罚金额");
		
		addModelField(REMARK, "Remark", "备注");
		addModelField(REALDATE, "Real date", "发生日期");
		addModelField(CREATED, "Creat", "创建");
	}
	
	@Override
	protected void addSearchFields() {
		super.addSearchField(convertPropertyToField(EMPLOYEE, DEPTIDS, REALDATE));
	}
	
	@Override
	protected void addListFields() {
		addListField(convertPropertyToField(EMPLOYEE, DEPARTMENT, REALDATE, REWARDAMOUNT, PUNISHAMOUNT, REMARK, CREATED, CREATEDON ));
	}
	
	@Override
	protected void addDetailFields() {
		addDetailField(convertPropertyToField(EMPLOYEE, REALDATE, REWARDAMOUNT, PUNISHAMOUNT, REMARK));
	}
	
	@Override
	protected void gatherExproperties() {
		exProperties.put(REQUIRED, new String[]{EMPLOYEE, REALDATE, AMOUNT});
	}
	
}
